<?php
/*
 * Created on 21 janv. 2009
 * Created by Ludovic Reenaers
 * lreenaers@hotmail.com
 */
 class View
{
	private $doctype;
	private $head;
	private $title;
	private $content;
	private $footer;
	private $html;
	private $boxes;
	private $menuGauche;
	private $menuDroite;
	private $menuHaut;
	protected $translator;

	function __construct($t,$menuGStr,$Translator,$doctype="XHTML1.0T",$layout="BASE",$headertype="BASE")
	{
		$this->translator = $Translator;		
		$this->doctype.=file_get_contents("../html/encodings/".$doctype)."\n";
		$moduleCss='<link rel="stylesheet" type="text/css" href="/brahma/css/'.$_SESSION["module"].'.css" />';
		$actionCss='<link rel="stylesheet" type="text/css" href="/brahma/css/'.$_SESSION["action"].'.css" />';
		$this->head .= file_get_contents("../html/headers/".$headertype)."\n".$moduleCss."\n".$actionCss."\n";
		
		$this->title .= "<title>".ucfirst($t)."</title>\n";
	    $this->html .= file_get_contents("../html/templates/".$layout);
	    $this->menuGauche=$menuGStr;
	    $this->menuDroite="<ul><li>toto</li><li>titi</li></ul>";
	    $this->menuHaut="Bonjour menu haut";
	    $this->footer="pied de page petit";
	    
	}

	function setContent($str)
	{
		$this->content.=$str;
	}

	function getPage()
	{
		$arrayBase=array("DOCTYPE","HEAD","TITLE","CONTENT","FOOTER","MENUG","MENUD","MENUH");
		$arrayView=array($this->doctype,$this->head,$this->title,$this->content,$this->footer,$this->menuGauche,$this->menuDroite,$this->menuHaut);
		$ret=str_replace($arrayBase,$arrayView,$this->html);
		return $ret;
	}

}
?>
